package cn.yangliu.repository;

import cn.yangliu.entity.Setting;
import cn.yangliu.jpa.base.repository.BaseRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Optional;

/**
 * @author 问道于盲
 * @date 2021-09-28
 */
public interface SettingRepository extends BaseRepository<Setting, Long> {

    boolean existsByName(String name);

    @Query("from Setting where name = :name and id <> :id")
    Optional<Setting> existNotEqualsId(String name, Long id);
}
